package org.snail.proxy.server;

import com.google.common.collect.Maps;
import org.snail.proxy.proto.ProxyRequest;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class ProxyMapping {
    private final Map<Integer, ProxyRequest> mapper = Maps.newHashMap();

    public void add(int port, ProxyRequest clientAddress) {
        mapper.put(port, clientAddress);
    }

    public void remove(int port) {
        mapper.remove(port);
    }

    public ProxyRequest getAddress(int port) {
        return mapper.get(port);
    }
}
